using Backoffice.Domain.Entities;
using Backoffice.Domain.Entities.App;

namespace BackOffice.Domain.Entities.App;

public class AppFolder : EntityBase
{
    public string? Name        { get; private set; }
    public string? Description { get; private set; }
    public Guid?   ParentId    { get; private set; }

    /* 导航属性 */
    public virtual AppFolder?      Parent   { get; private set; }
    public virtual List<AppFolder> Children { get; private set; } = new();
    public virtual List<AppFile>   Files    { get; private set; } = new();

    private AppFolder() { }

    public AppFolder(string name, string? desc = null, Guid? parentId = null)
    {
        Name        = name;
        Description = desc;
        ParentId    = parentId;
    }

    public void Rename(string newName) => Name = newName;
    public void Move(Guid? newParentId) => ParentId = newParentId;
    public void UpdateDesc(string? desc) => Description = desc;
}